package com.example.sb.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.RedisSerializer;

/**
 * @author kedong.lin
 */

public class RedisConfig {
    @Autowired
    RedisTemplate<Object,Object> redisTemplate;
    @Bean
    public RedisTemplate initRedisTemplate(){
        RedisSerializer<String> stringSerializer = redisTemplate.getStringSerializer();
        redisTemplate.setDefaultSerializer(stringSerializer);
        redisTemplate.setHashKeySerializer(stringSerializer);
        redisTemplate.setHashValueSerializer(stringSerializer);
        return redisTemplate;
    }
}
